import store from '@/store'

let Uaddjson = [{
		value: 'uUser',
		label: '用户名',
		rule: [{
			required: true,
			message: '请输入用户名',
			trigger: 'blur',
		}, ],
	},
	{
		callback: (data) => {
			console.log('callbackcallback', data)
			let r = []
			r.push({
				value: 'dma',
				label: '密码',
				type: 'password',
				rule: [{
						required: true,
						message: '请输入密码',
						trigger: 'blur',
					},
					{
						message: '密码最少为6位数字和字母构成',
						trigger: 'blur',
						validator(rule, value, callback) {
							if (!uni.$u.test.dma(value)) {
								callback(new Error('error'))
							} else {
								callback()
							}
						},
					},
				],
			})

			function qrdma(value, callback, data) {

				if (data.dma != value) {
					callback(new Error('error'))
				} else {
					callback()
				}
			}
			r.push({
				value: 'qrdma',
				label: '确认密码',
				type: 'password',
				rule: [{
					required: true,
					message: '请再次输入密码',
					trigger: 'change',
					validator(rule, value, callback, data) {

						qrdma(value, callback, data)
					},
				}, ],
			})

			return r
		},
	},

	{
		value: 'utype',
		label: '用户类型',
		type: 'select',
		option: [{
				value: '0',
				label: '代理商'
			},

			{
				value: '19',
				label: '合作伙伴'
			},
			{
				value: '20',
				label: '物业'
			},

		],
		defaultValue: "19",
	},
	{
		value: 'pcs',
		label: '所属站点',
		type: 'pcs',
		if: {
			zhi: [{
				value: 'utype',
				zhi: [
					'0',
					'1',
					'2',
					'3',
					'4',
					'5',
					'6',
					'7',
					'8',
					'9',
					'10',
					'11',
					'12',
					'13',
					'14',
					'15',
					'16',
					'17',
					'21',
					'22',
					'23',
					'24',
					'25',
				],
			}, ],
		},

	},

	{
		value: 'dl',
		label: '发卡限额',
		fl: '100',
		defaultValue: '0',
		if: {
			zhi: [{
				value: 'utype',
				zhi: ['21']
			}],
		},
	},
	{
		value: 'uxm',
		label: '联系人',
	},
	{
		value: 'utel',
		label: '电话号码',
	}, {
		value: 'yzm',
		label: '验证码',
		type: "yzm"
	},
	{
		callback: (data) => {
			let r = []
			let bzstr = '备注'
			if (
				['11', '20'].find((e) => {
					return e == data.utype
				})
			) {
				bzstr = '物业名称'
			}
			r.push({
				value: 'bz',
				label: bzstr,
				if: {
					zhi: [{
						value: 'utype',
						zhi: [
							'0',
							'1',
							'2',
							'3',
							'4',
							'5',
							'6',
							'7',
							'8',
							'9',
							'10',
							'12',
							'13',
							'14',
							'15',
							'16',
							'17',
							'18',
							'19',
						],
					}, ],
				},
			})
			return r
		},
	},
]
export default {
	Uaddjson
}